package com.ternnetwork.core.controller.log;

import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.ternnetwork.commons.utils.PrintWriterUtils;
import com.ternnetwork.core.entity.log.AuthenticationLog;
import com.ternnetwork.core.service.log.AuthenticationLogService;
import com.ternnetwork.persistence.page.Page;



@Controller@Scope("prototype")
@RequestMapping("/core/log/authentication/*")
public class AuthenticationLogController {
	
    @Resource
    private AuthenticationLogService authenticationLogService;
  
    @RequestMapping("manage.htm")
	public ModelAndView manage(){
		return new ModelAndView("/WEB-INF/view/core/log/authentication_log_manage.jsp");
	}
  
    @RequestMapping("query.htm")
	public void query(PrintWriter out,HttpServletResponse response,AuthenticationLog t,String createTimeMin,String createTimeMax,String sort,String order,int limit, int offset){
		Page page=Page.createPage(limit, offset);
		PrintWriterUtils.printString(out, response, authenticationLogService.queryToJsonStr(t,createTimeMin,createTimeMax, page));
	}

}
